package com.cntcdt.api.db.dao;

import java.util.List;

import com.cntcdt.api.db.dao.base.DeviceChargeDaoBase;
import com.cntcdt.api.db.model.DeviceChargeModel;


/**
 * 这是cdt_device_charge的Dao实现类
 */
public class DeviceChargeDao extends DeviceChargeDaoBase   {
    /**
     * DeviceChargeDao对象
     */
    private static DeviceChargeDao instance = new DeviceChargeDao();

    /**
     * 默认构造方法
     */
    private DeviceChargeDao() {
    }

    /**
     * 获得对象实例
     */
    public static DeviceChargeDao getInstance() { 
         return instance;
    } 
    
    /**
     * 按deviceId查询model
     * @param id id
     * @return model
     */
    public DeviceChargeModel findByDeviceId(Integer deviceId) {
        String sql = "SELECT * FROM " + TABLE + " WHERE deviceId = ?";
       Object[] paramObjs = {deviceId};
       List<DeviceChargeModel > modelList = this.queryModelList(sql, paramObjs);
       if(modelList != null && modelList.size() > 0){ 
             return  modelList.get(0);
       } 
       return null;
   }
    
    /**
     * 按deviceId查询model
     * @param id id
     * @return model
     */
    public List<DeviceChargeModel > findByPage(int sortTime) {
//       sortTime = sortTime*20;
       String sql = "SELECT * FROM " + TABLE;
//       Object[] paramObjs = {sortTime};
       List<DeviceChargeModel > modelList = this.queryModelList(sql, null);
       return modelList;
   }

}
